function printPdf(url,params) {
  if (url && url.length > 0) {
    var strParam = '';
    if(params){
      for (var prop in params) {
         //prop = $.trim(prop);
         strParam = strParam+prop+"="+encodeURI(encodeURI(params[prop]))+"&";
      }
      //strParam = encodeURI(encodeURI(strParam));
      if(url.indexOf('?') > -1) {
          url = url+"&"+strParam;
      }else{
          url = url+'?'+strParam;
      }
    }
         // url = encodeURI(encodeURI(url));
    var iframe = top.document.getElementById("#print_iframe");
    if (!iframe) {
      //create print iframe
      var el = top.document.createElement('IFRAME');
      el.id = "print_iframe";
      el.src = "about:blank";
      el.height = 0;
      el.width = 0;
      el.style = "height: 0px; width: 0px; display: none;";
      top.document.body.appendChild(el);
      iframe = el;
      if (iframe.attachEvent) {
        iframe.attachEvent("onload", function() {
            //iframe加载完成后你需要进行的操作
            var frame = this;
            setTimeout(function() {
              if ("about:blank" != frame.src) {
                frame.contentWindow.print();
                //layer.close(mask);
              }
            }, 0);

            });
      } else {
          iframe.onload = function() {
            var frame = this;
            setTimeout(function() {
              if ("about:blank" != frame.src) {
                //$.messager.progress('close');
                frame.contentWindow.print();
                //layer.close(mask);
              }
            }, 0);
          };
      }
    }
    //var mask = layer.load();
    iframe.setAttribute('src',url);
  } else {
    alert("无法打印：URL为空~~!");
  }
}

export function printUReport(reportFile, params) {
  params = params||{};
  if (reportFile.indexOf('.xml')<0){
    reportFile = reportFile+'.ureport.xml';
  }
  params['_u']='file:'+reportFile;
  printPdf('/ureport/pdf/show',params);
  //iframe.window.focus();
}

